package com.thomas.collection;

/**   
* @Description: TODO(用一句话描述该文件做什么) 
* @author thomas_liu  
* @date 2018年5月14日 下午4:15:56 
* @version V1.0   
*/
public class Item implements Comparable<Item> {
	
	
	private String description;
	
	private int partNumber;
	
	public Item(String description, int partNumber) {
		super();
		this.description = description;
		this.partNumber = partNumber;
	}
	
	public String getDescription() {
		return description;
	}

	@Override
	public String toString() {
		return "Item [description=" + description + ", partNumber=" + partNumber + "]";
	}
	
	public boolean equals(Object otherObject){
		if(this == otherObject) return true;
		if(otherObject == null) return false;
		if(getClass() != otherObject.getClass())return false;
		Item other = (Item)otherObject;
		return description.equals(other.description)&&partNumber == other.partNumber;
	}
	
	public int hashCode(){
		return 13*description.hashCode()+ 17*partNumber;
	}
	

	public int compareTo(Item other) {
		return partNumber - other.partNumber;
	}
	
	
	
}
